<template>
	<view>
		<view class="box">
			<view >
				<input  class="width84 card" v-model="card" type="idcard" placeholder="请输入身份证号" maxlength="18"/>
			</view>
			<view class="tip_message">
				⬆⬆⬆{{tipMessage}}
			</view>
			<view class="width84">
				<button @click="submit()">确认</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item:{},
				card:"",
				tipMessage:"输入身份证号进行挂号"//未查询到该住院号信息
			}
		},
		onLoad(option) {
			if(option.item){
				this.init(JSON.parse(option.item));
			}
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('params', data=> {
			    console.log(data)
			  })
			
		},
		methods: {
			init(item){
				//信息初始化
				this.item=item;
			},
			submit(){
				//数据提交判断
				if(this.card==""||this.card.length<18){
					this.tipMessage="请输入有效身份证号"
					return;
				}
				let data={
					"kh0000":this.card,
					"klx000":"3",
					"ywlsh0":""+ new Date().getTime(),
					"funid":"F07.02.02.01"
				}
				uni.showLoading({mask:true,title: '加载中...'})
				this.$postJson("/qnyesb/qnyesbproxy",data,res=>{
					//判断用户不存在档案信息则进行跳转
					if(res.state==0&&res.data){
						uni.setStorageSync("user",res.data);
						uni.navigateTo({
							url:"../appointmentDetail/appointmentDetail?item="+JSON.stringify(this.item)
						})
					}else{
						uni.redirectTo({
							url:"../bindInfo/bindInfo?kh0000="+this.card
						})
					}
					uni.hideLoading();
				})
			}
		}
	}
</script>

<style>
.box{
	width: 96%;
	height: 170px;
	margin: 0 auto;
	background: #FFFFFF;
	padding-top: 21px;
	top: 10px;
	position: relative;
}
.box .card{
	height:39px;
	border: 1px solid #e6e6e6;
	border-radius:32px;
	text-indent: 1em;
}
.box .tip_message{
	text-align: center;
	font-size: 12px;
	font-family: Source Han Sans CN;
	font-weight: 400;
	line-height: 40px;
	color: #ff0000;
	
}
.width84 button{
	background: #3692FF;
	color: #ffffff;
}
</style>
